<!DOCTYPE html>
<html>
<head>
<title>管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="/favicon.ico" rel="shortcut icon">
<link rel="stylesheet" href="__CSS__/layui/css/layui.css">
<link rel="stylesheet" href="__CSS__/admin/css/style.css">
<script src="__CSS__/layui/layui.js" type="text/javascript"></script>
</head>
<body>
<style type="text/css">
body {width: 100%;height: 100%;background: #252935;}
</style>
<div class="tpt-login">
<div class="tpt-logins">
<h2>管理系统</h2>
<form class="layui-form">
	<div class="layui-form-item">
		<input type="text" name="name" placeholder="账号：" lay-verify="required" autocomplete="off" class="layui-input">
	</div>
	<div class="layui-form-item">
		<input type="password" name="password" placeholder="密码：" lay-verify="required" autocomplete="off" class="layui-input">
	</div>
	<div class="layui-form-item">
	<img id="verify_img" src="{:captcha_src()}" alt="验证码" onclick="refreshVerify()">
    <a href="javascript:refreshVerify()">点击刷新</a>
	</div>
	<div class="layui-form-item">
		<input type="text" name="verify" placeholder="验证码" lay-verify="required" autocomplete="off" class="layui-input">
	</div>
	<div class="layui-form-item">
		<button style="padding: 0 102px;" class="layui-btn" lay-submit="" lay-filter="login_index">登录后台</button>
	</div>
</form>
</div>
</div>
<script>
function refreshVerify() {
        var ts = Date.parse(new Date())/1000;
        var img = document.getElementById('verify_img');
        img.src = "captcha?id="+ts;
    }
layui.use('form', function () {
var form = layui.form,
jq = layui.jquery;
form.on('submit(login_index)', function (data) {
loading = layer.load(2, {
	shade: [0.2, '#000']
});
var param = data.field;
jq.post('/admin.php/login/login', param, function (data) {
console.log(data)

if (data.code == 200) {
	layer.close(loading);
	layer.msg(data.msg, { icon: 1, time: 2000 }, function () {
		location.href = '/admin.php/index/index.html';
	});
} else {
	layer.close(loading);
	layer.msg(data.msg, { icon: 2, anim: 6, time: 3000 });
	refreshVerify();
}
});
return false;
});
})
</script>
</body>
</html>